package com.upsuns.pbio;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 *@Description:<p>采用线程池管理，伪异步IO模型</p>
 *@author 王旭
 *@time 2016年3月17日 上午11:11:37
 */
public class TimeServerExecutePool {
	
	private ExecutorService executor;
	
	public TimeServerExecutePool(int maxPoolSize, int queueSize) {
		this.executor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), 
				maxPoolSize, 120L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(queueSize)); 
	}
	
	public void execute(Runnable task) {
		executor.execute(task);
	}
	

}
